<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
<base href="${pageContext.request.contextPath}/">

<meta http-equiv="Content-Type" content="text/html;charset=gbk" />
<title>新闻中国</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script>
	function check() {
		var login_username = document.getElementById("uname");
		var login_password = document.getElementById("upwd");
		if (login_username.value == "") {
			alert("用户名不能为空！请重新填入！");
			login_username.focus();
			return false;
		} else if (login_password.value == "") {
			alert("密码不能为空！请重新填入！");
			login_password.focus();
			return false;
		}
		return true;
	}

	function focusOnLogin() {
		var login_username = document.getElementById("uname");
		login_username.focus();
	}
</script>
</head>




<body onload="focusOnLogin()">

	<div id="header">
	
		<c:set var="isLogin" value="${empty user }" />
		<c:if test="${isLogin}">
			<div id="top_login">
				<form action="LoginServlet" method="post" onsubmit="return check()">
					<label> 登录名 </label>
					<input type="text" name="uname" id="uname" value="${param.uname}" class="login_input" />
					<label> 密&#160;&#160;码 </label>
					<input type="password" name="upwd" id="upwd" value="" class="login_input" />
					<input type="submit" class="login_sub" value="登录" />
					<label id="error" style="color: red;">${mess}<c:remove var="mess" scope="request"/></label>
					<img src="images/friend_logo.gif" alt="Google" id="friend_logo" />
				</form>
			</div>
		</c:if>
		<c:if test="${!isLogin}">
			<h4>欢迎您&#160;${user.uname}&#160;&#160;&#160;&#160;<a href="AdminServlet">个人中心</a>&#160;&#160;&#160;&#160;<a href="LogoutServlet">login out</a></h4>
		</c:if>
		<div id="nav">
			<div id="logo">
				<img src="images/logo.jpg" alt="新闻中国" />
			</div>
			<div id="a_b01">
				<img src="images/a_b01.gif" alt="" style="margin-top: 20px;"/>
			</div>
			<!--mainnav end-->
		</div>
	</div>


	<div id="container">
		<jsp:include page="include_elements/index_sidebar.jsp"></jsp:include>

		<div class="main">
			<div class="class_type">
				<img src="images/class_type.gif" alt="新闻中心" />
			</div>
			<div class="content">
				<jsp:include page="include_elements/index_navbar.jsp"></jsp:include>
				
				<ul class="classlist">
					<c:forEach items="${pageNews.list}" var="n">
						<li><a href='ReadNewsServlet?nid=${n.nid}'>${n.ntitle}</a><span>${n.nmodifyDate}</span></li>
					</c:forEach>
			      	  	
		  	  		<li  style="padding-right:0px;"><p align="right"> 当前页数:[${pageNews.pageNo}/${pageNews.pageNums}] 
				   	&nbsp;<a href="IndexServlet?pageNo=1&tid=${ntid}">首页</a>
				   	<c:if test="${pageNews.pageNo>1}">
				   		&nbsp;<a href="IndexServlet?pageNo=${pageNews.pageNo-1}&tid=${ntid}">上一页</a>
				   	</c:if>
				   	<c:if test="${pageNews.pageNo<pageNews.pageNums}">
				   		&nbsp;<a href="IndexServlet?pageNo=${pageNews.pageNo+1}&tid=${ntid}">下一页</a>
				   	</c:if>
				   	&nbsp;<a href="IndexServlet?pageNo=${pageNews.pageNums}&tid=${ntid}">末页</a>
				   	<c:remove var="pageNews" scope="request"/>
				   	</p></li>
				</ul>
			</div>
			<jsp:include page="include_elements/index_rightbar.jsp"></jsp:include>
		</div>
	</div>
	<div id="friend">
		<h1 class="friend_t">
			<img src="images/friend_ico.gif" alt="合作伙伴" />
		</h1>
		<div class="friend_list">
			<ul>
				<li><a href="#">百度</a></li>
				<li><a href="#">谷歌</a></li>
				<li><a href="#">新浪</a></li>
				<li><a href="#">网易</a></li>
				<li><a href="#">搜狐</a></li>
				<li><a href="#">人人</a></li>
				<li><a href="#">中国政府网</a></li>
			</ul>
		</div>
	</div>
	<div id="footer">
		<jsp:include page="include_elements/bottom.jsp"></jsp:include>
	</div>
</body>
</html>

